package main

import (
	"fmt"
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"log"
)

func ConnectDb() *gorm.DB {
	conn, err := gorm.Open(mysql.Open("root:root@tcp(82.157.192.206:3307)/learngo?parseTime=true"))
	if err != nil {
		log.Fatal("数据库连接失败：", err)
	}
	fmt.Println("连接数据库成功")
	return conn
}
